EPT (Edit and Presentation Templates) is a technique to manage information separated from the presentation. EPT can be used to define any kind of data set, from the most basic drop-down menus to complex database solutions. The same set of data can be presented in many different ways depending on the context. All EPT documents can be created and edited directly in Content Studio with drag-and-drop techniques.
The presentation formatting, layout and design is specified with Presentation Templates. The same set of information can be presented in different ways by applying different Presentation Templates.
Edit templates (ET)
The information structured and defined with Edit Template forms, where all data elements are specified. The Edit Template form contains the classic FORM objects such as input boxes, list boxes, radio buttons etc. They may also contain AS components, synchronous Java scripts and other components. The values of the form objects can be automatically validated to ensure that they have reasonable values.
The forms will automatically create XDR schemes to describe the data structure. The data is stored as XML and can easily be reused, exported, filtered and searched. The database storage is automatically managed, so there is no need to manually manage database tables when the data structure is altered.
Edit Template forms can be used with Content Studio, on the web site or on an intranet (using the DocumentWriter component). They can also be shared within a Multi Language Cluster (MLC). Both UTF-8 and right-adjusted editing forms are supported.
Form keywords and attributes
The data elements can be specified in detail either using the visual editor or by code. Each new element is given a default set of values to allow generic data input. The set of possible attributes depend on the type of object that is being used. The list below describes some of the generic attributes that can be used to describe the data object.
Attribute | Description |
---|---|
required | The object must have a value. It cannot be left blank or empty. |
id | The unique identifier of the object. |
name | The name of the object, which usually is the same as the identifier. The content of the field will be used as name for the document. |
tabindex | A numeric value to control the tab order of the form elements. If not used, the tab order is defined by the order of the objects. |
cstitle | The title of the document. The content of the field will be used as title for the document. If many object use this attribute, the document title will be the sum of all these values. |
introduction |
The introduction of the document. The content of the field will be used as introduction
for the document. If many object use this attribute, the document introduction will
be the sum of all these values.
The content of the introduction field in the document are included in full text search. |
cspublishdate | The publish date of the document (when it first will be visible on the web site). The content of the field will be used as publishdate for the document. |
csarchivedate | The archive date of the document (when it no longer will be visible on the web site). The content of the field will be used as archivedate for the document. |
minlength | The least number of characters to be allowed. |
The value must be an e-mail address. The validation is purely syntactical and there is no confirmation that the supplied address actually exists. | |
personalid | The value must be a valid social security number according to the Swedish standard (YYMMDD-XXXX) |
integer | The value must be an integer. When set it is also possible to define the attributes morethen, lessthen and not to control the values to allow. |
elementimage | The value is a reference to an image |
elementurl | The value is an URL |
elementtarget | The value indicates the target of an URL |
keywords |
The keywords of the document. The content of the field will be copied into the keywords
field of the document. As the keyword field of documents are used in full text search,
the keywords can be used to add more match words. Keywords are normally not visible on the web site, instead they are used when searching the web site. |
The attributes are added automatically by Content Studio when generating the code. Here is an example of what the generated code can look like:
Html <input id="text1" tabindex="0" name="text1" minlength="6" cstitle="1" required="1" />
Javascript events
Content Studio supports synchronous Javascript events. They make it possible to for example perform advanced input validation, user notification and other actions connected to certain document operations. Since the Javascript events are synchronous, they can be used to interrupt or prevent other events from taking place.
Events are configured by assigning special variables the value of Javascript function names. The variable names describe the event to which they are connected. The following special variable names are available:
- OnPageLoad
- OnBeforePageLoad
- OnBeforeDocumentSave
- OnBeforeDocumentCreate
- OnBeforeDocumentPreview
- OnBeforeDocumentCheckIn
- OnBeforeDocumentCheckOut
- OnBeforeDocumentApprove
- OnBeforeDocumentReject
- OnBeforeDocumentDelete
- OnDocumentSave
- OnDocumentCreate
- OnDocumentCheckIn
- OnDocumentCheckOut
- OnDocumentApprove
- OnDocumentReject
- OnDocumentDelete
- OnBeforePerformUserAction (NOT IMPLEMENTED YET)
- OnPerformUserAction (NOT IMPLEMENTED YET)
- OnBeforeSendForRevision
- OnSendForRevision
All events can be prevented from being executed by letting the function that is executed before the event (named OnBefore...) return a false value. Then, the following event is ignored. This is typically used then validating field values.
Here is an example where the fields of an ET form are combined before the page is saved or previewed.
Javascript< script language="jscript" >
function combineFields()
{
var sPre = (male.checked) ? "Mr. " : "Ms. ";
full_name.value = sPre + surname.value + " " + last_name.value;
return true;
}
OnBeforeDocumentSave = "combineFields();";
OnBeforeDocumentPreview = OnBeforeDocumentSave;
</script>
Presentation templates (PT)
Presentation templates are used to present XML data sources, typically ET forms. The Presentation template controls which fields to display and how they are displayed. It can of course also contain static text, dynamic components and all other things that can be included in a displayed document.
The Presentation template is always used dynamically and by reference. This means that changes in the presentation template will have effect on all places where it is used without any additional effort.
Documents within a category can be assigned a default Presentation template that is used unless otherwise specified. The default value can be overridden by explicitly use a particular PT identifier (PTID) when referring to a document. The PT is identified by the document in which it is defined.
Example when referring to a document (id=2000) using its default PT:
http://www.mysite.com/default.aspx?id=2000
Example when using the PT defined in document 3000:
http://www.mysite.com/default.aspx?id=2000&PTID=3000
EPT-related properties and methods
There are a large number of properties to work with when creating EPT documents. Most of the functionality in regular documents is also available in EPT documents. The complete set of available methods and variables are described in the API documentation.
Name | Description |
---|---|
|
This property, meaningful in EPT presentation templates only, gets an
The following code snippet shows how to get the value of an EPT field named Header Response.Write(CS_DataFields["Header"]);
Response.Write(CS_DataFields("Header"))
|
|
Gets an
|
|
Gets the identifier of the document where it is used. If it is used within an included document it will use the identity of the included document, not the identity of the including document. In a presentation template, this is the presented document rather than the presentation template itself. |
|
Gets the identity of the Presentation template that is being used. |
|
Gets the identifier of the category of the document. |
|
This method returns an
|
Data categories
The general definition of a document is something that store data according to a specified ET. It does not have to be a HTML page. Document categories that mainly are intended to keep simple data are sometimes referred to as data categories. But any category with documents that are based on an ET can be considered a data category.
A very common situation when developing a website is to manage a small set of more or less dynamic data, i.e. to fill a dropdown box that is used within a form. This can often easily be solved by using documents in a specific category. To enable the EPT fields to be used as data fields, they must be indexed.
Here follows a simple example of using EPT data categories to fill a dropdown box using the AS component "List filtered documents in dropdown advanced 2.0". To fill the dropdown box, simply do the following under component properties:
- "List settings / Field to fill in the dropdown": Select the data category to use, using the browse button. That will fill the dropdown with all available data fields. Select the field that is to be used for display.
- "List settings / Value field": It is possible to select a return value from the same data category that is connected to each element in the dropdown box. Typically, it is some kind of identifier that is connected to plain text information. If not selected, the return value will be the same as the displayed value.
- "Selected value": Optionally, point out a pre-selected value in the dropdown box. If there is a value that matches the expression, it will be pre-selected.
- "Xml index settings": If only some documents in the data category should be used,
it is possible to add filter criteria. Define the data fields that you want to use
with the "XMLField" dropdown boxes. Write the filtering criteria that describes
which documents to include in the listing. Field names must be enclosed in square
brackets. This sample will list only those documents whose "fetch" field has the
value "on".
[fetch]='on'
The component has many settings, but here we focus only on the data that is picked from the data categories. The layout definitions, cache settings and similar are described elsewhere for each component.